package com.wfh.rpc.loadbalancer;

import com.wfh.rpc.spi.SpiLoader;

/**
 * @Title: LoadBalancerFactory
 * @Author wangfenghuan
 * @Package com.wfh.rpc.loadbalancer
 * @Date 2025/10/16 21:17
 * @description: 负载均衡工厂
 */
public class LoadBalancerFactory {

    static {
        SpiLoader.load(LoadBalancer.class);
    }

    /**
     * 默认负载均衡器
     */
    private static final LoadBalancer DEFAULT_LOAD_BALANCER = new RoundRobinLoadBalancer();

    /**
     * 获取实例
     * @param key
     * @return
     */
    public static LoadBalancer getInstance(String key){
        return SpiLoader.getInstance(LoadBalancer.class, key);
    }
}
